#ifndef SCRIPTMANAGER_H
#define SCRIPTMANAGER_H

#include <vector>

#include "script/Interpreter.h"
#include "core/Object.h"

class ScriptObject
{
public:
	ScriptObject(std::string type) : mType(type) {}
	ScriptObject(std::string type, std::string event, std::string code) : mType(type), mEvent(event), mCode(code) {}
	ScriptObject(::Object o)
	{
		mType = o.getWithDef<std::string>("type", "");
		mEvent = o.getWithDef<std::string>("event", "");
		mCode = o.getWithDef<std::string>("code", "");
	}

	::Object toObject(void)
	{
		::Object o;
		o.addProperty<std::string>("type", mType);
		o.addProperty<std::string>("event", mEvent);
		o.addProperty<std::string>("code", mCode);
		return o;
	}

	virtual ~ScriptObject() {}

//private:
	std::string mType;
	std::string mEvent;
	std::string mCode;
};

class ScriptManager
{

public:
	ScriptManager();
	virtual ~ScriptManager();

	static ScriptManager* getSingletonPtr( void );

	void execute(ScriptObject *so);


	bool hasInterp(const std::string& lang);
	Interpreter* getInterp(const std::string& lang);

//	private:
	std::vector<Interpreter*> interps;

protected:
	static ScriptManager* mScriptManager;
};

#endif // SCRIPTMANAGER_H
